Git Recipes: A Problem-Solution Approach by Wlodzimierz Gajda

Git Recipes: A Problem-Solution Approach by Wlodzimierz Gajda

Author:Wlodzimierz Gajda
Language: eng
Format: mobi, epub, pdf
Tags: Software Development, Programming, Testing & Engineering, Software Design, Computer Science, Education & Reference, Computers & Technology
ISBN: 9781430261032
Publisher: Apress
Published: 2013-11-20T05:00:00+00:00


Create a new repository that will contain two revisions: a and b. The first revision should include one file a.txt and the second revision should include three files: b.txt, c.txt, and d.txt:

$ cd git-recipes

$ git init 08-04

$ cd 08-04

$ echo a > a.txt

$ git add -A

$ git commit -m a

$ echo b > b.txt

$ echo c > c.txt

$ echo d > d.txt

$ git add -A

$ git commit -m b

Verify that the repository contains two revisions with the $ git log --oneline command and that the last revision really contains three files. The output of the $ git show --name-only command will print three filenames: b.txt, c.txt, and d.txt.

Now, reset your history to revision a, preserving the modifications introduced by revision b in the working directory as the new uncommitted change. You can do this with the $ git reset HEAD∼ command. After this command the state of your repository returned by $ git status -sb will be the following:

?? b.txt

?? c.txt

?? d.txt

As you can see the files are now untracked. You can create three different revisions with:

$ git add b.txt

$ git commit -m b



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.